package com.rz.htk.order.controller;

import com.rz.core.kit.RespKit;
import com.rz.core.resp.ResultResp;
import com.rz.htk.order.entity.Commodity;
import com.rz.htk.order.entity.vo.OrderDeleteParam;
import com.rz.htk.order.service.CommodityService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/commodity")
public class CommodityController {

    @Resource
    private CommodityService commodityService;

    @PostMapping("/getPage")
    public ResultResp getPage(@RequestBody Commodity commodity){
        return RespKit.success(commodityService.getPage(commodity));
    }

    @PostMapping("/saveProduct")
    public ResultResp saveProduct(@RequestBody Commodity commodity){
        return RespKit.success(commodityService.saveCommodity(commodity));
    }

    @PostMapping("/batchDelete")
    public ResultResp batchDelete(@RequestBody OrderDeleteParam deleteParam){
        return RespKit.success(commodityService.batchDelete(deleteParam));
    }
}
